package cc.bukkitPlugin.banitem;

import cc.bukkitPlugin.banitem.api.ModAPIMan;
import cc.bukkitPlugin.banitem.check.ItemCheck;
import cc.bukkitPlugin.banitem.command.CommandExc;
import cc.bukkitPlugin.banitem.listener.BlockListener;
import cc.bukkitPlugin.banitem.listener.PlayerListener;
import cc.bukkitPlugin.banitem.manager.ConfigManager;
import cc.bukkitPlugin.banitem.manager.ItemManager;
import cc.bukkitPlugin.banitem.manager.LangManager;
import cc.bukkitPlugin.banitem.manager.PermissionMan;
import cc.bukkitPlugin.util.plugin.ABukkitPlugin;

public class BanItem extends ABukkitPlugin<BanItem>{

    private PlayerListener mPL;
    private BlockListener mBL;
    private CommandExc mCmdExc;

    public BanItem(){
        super("BanItem");
    }

    /**
     * 此函数中不要进行模块间的互相调用<br />
     * 调用操作请在reload函数中进行
     */
    public void onEnable(){
        //注册管理器
        this.setLangManager(new LangManager(this));
        this.registerManager(this.getLangManager());
        this.setConfigManager(new ConfigManager(this));
        this.registerManager(this.getConfigManager());
        this.registerManager(new PermissionMan(this));
        this.registerManager(new ItemCheck(this));
        this.registerManager(new ItemManager(this));
        //初始化API
        ModAPIMan.init();
        //注册监听器
        this.mPL=new PlayerListener(this);
        this.mBL=new BlockListener(this);
        //绑定命令管理器
        this.mCmdExc=new CommandExc(this);
        //初始化管理器并载入配置
        this.reloadPlugin(null);
    }

    public CommandExc getCommandExc(){
        return this.mCmdExc;
    }

    public ConfigManager getConfigManager(){
        return (ConfigManager)super.getConfigManager();
    }

    public static BanItem getInstance(){
        return ABukkitPlugin.getInstance(BanItem.class);
    }

}
